<template>
  <div>
    <h1>Message</h1>
  </div>
</template>

<script>
export default {
  beforeRouteEnter(to, from, next) {
    // beforeRouteEnter 不能获取组件实例 this，因为当守卫执行前，组件实例被没有被创建出来，剩下两个钩子则可以正常获取组件实例 this
    console.log('进入前');
    next();
  },
  beforeCreate() {
    console.log('beforeCreate');
  },
  created() {
    console.log('created');
  },
  beforeRouterUpdate(to, from, next) {
    console.log('模板被复用');
    next();
  },
  beforeRouteLeave(to, from, next) {
    console.log('离开前');
    next();
  },
};
</script>

<style lang="scss">
</style>